import { Module } from '@nestjs/common';
import { UserController } from './user.controller';
import { UserService } from './user.service';
import {UserEntity} from './user.entity'
import {TypeOrmModule} from '@nestjs/typeorm'
import {AuthGuard} from 'src/guard/auth.guard'
import {APP_GUARD,APP_INTERCEPTOR,APP_PIPE} from '@nestjs/core'
import {LoggingInterceptor} from 'src/interceptors/logging.interceptor'
import {ValidationPipe} from 'src/pipes/validation/validation.pipe'
import {NestLogModule} from 'ldx-nest-log'

@Module({
  imports:[
    TypeOrmModule.forFeature([
      UserEntity
    ]),
    NestLogModule.register('tset--')
  ],
  controllers: [UserController],
  providers: [
    UserService,
    //模块中使用守卫
    {
      provide:APP_GUARD,
      useClass:AuthGuard
    },
    //模块中使用拦截器
    // {
    //   provide:APP_INTERCEPTOR,
    //   useClass:LoggingInterceptor
    // }
    {
      provide:APP_PIPE,
      useClass:ValidationPipe
    }
  ]
})
export class UserModule {}
